package com.iqiyi.pps.epg.core.model.program;

/**
 * Created by karkarrotxu on 2016/6/22.
 */
public class ProgramNoticeCheckData {
    public static final long CHECK_AFTER_TIME = 600000L;


    public enum STATUS {
        IN_WAIT, PHASE_OVER_CHECK,PHASE_SEND
    }

    private long id;
    private long qipuId;
    private long fatherId;
    private long chatRoomId;
    private int chatEnable;
    private long startTime;
    private long overCheckTime;
    private long lastExcuteTime;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getFatherId() {
        return fatherId;
    }

    public void setFatherId(long fatherId) {
        this.fatherId = fatherId;
    }

    public boolean isOver() {
        return lastExcuteTime > startTime;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public void initByNoticeStartTime(long startTime) {
        this.startTime = startTime;
        this.overCheckTime = startTime + CHECK_AFTER_TIME;
        lastExcuteTime = 0;
    }

    public STATUS getCheckStatus(long checkTime) {
        if (checkTime >= overCheckTime) {
            return STATUS.PHASE_OVER_CHECK;
        } else if (checkTime >= startTime) {
            return lastExcuteTime >= startTime ? STATUS.IN_WAIT :  STATUS.PHASE_SEND;
        } else{
            return STATUS.IN_WAIT;
        }
    }

    public void setLastExcuteTime(long excuteTime) {
        this.lastExcuteTime = excuteTime;
    }

    public long getChatRoomId() {
        return chatRoomId;
    }

    public void setChatRoomId(long chatRoomId) {
        this.chatRoomId = chatRoomId;
    }
    public void setChatEnable(int chatEnable){
        this.chatEnable = chatEnable;
    }

    public int getChatEnable() {
        return chatEnable;
    }

    public long getQipuId() {
        return qipuId;
    }

    public void setQipuId(long qipuId) {
        this.qipuId = qipuId;
    }
}
